package cn.rongdao.jrkabao.ui.cashadvance.adapter;

import android.content.Context;
import android.view.ViewGroup;

import com.mifengkong.frtools.ui.adapter.recyclerview.FRBaseRecyclerAdapter;
import com.mifengkong.frtools.inputmethod.FRView;

import cn.rongdao.jrkabao.R;
import cn.rongdao.jrkabao.bean.cashadvance.CreditAndDepositCardBean;

/**
 * Created by jack on 2017/6/2
 */

public class CreditAndDepositCardAdapter extends FRBaseRecyclerAdapter<CreditAndDepositCardBean, CreditAndDepositViewHolder> {

    private OnCreditCardClickListener onCreditCardClickListener;

    public CreditAndDepositCardAdapter(Context context, OnItemClickListener<CreditAndDepositViewHolder> listener) {
        super(context, listener);
    }

    @Override
    public CreditAndDepositViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new CreditAndDepositViewHolder(FRView.inflateLayout(getContext(), R.layout.item_credit, parent, false), onCreditCardClickListener);
    }

    public void setOnCreditCardClickListener(OnCreditCardClickListener onCreditCardClickListener) {
        this.onCreditCardClickListener = onCreditCardClickListener;
    }

    public boolean isDefaultCreditCard(int position) {
        return getDataList().get(position).getIs_default().equals("1");
    }
}
